using System;
using System.ComponentModel.DataAnnotations;

namespace EFCoreEnterpriseDemo.Models
{
    public interface ISoftDelete
    {
        bool IsDeleted { get; set; }
        DateTime? DeletedAt { get; set; }
        string? DeletedBy { get; set; }
    }

    public interface IDataPermission
    {
        int? TenantId { get; set; }
        int? DepartmentId { get; set; }
        string? CreatedBy { get; set; }
    }

    public abstract class BaseEntity : ISoftDelete, IDataPermission
    {
        [Key]
        public int Id { get; set; }

        // 审计字段
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
        public string? CreatedBy { get; set; }
        public DateTime? UpdatedAt { get; set; }
        public string? UpdatedBy { get; set; }

        // 软删除
        public bool IsDeleted { get; set; }
        public DateTime? DeletedAt { get; set; }
        public string? DeletedBy { get; set; }

        // 数据权限
        public int? TenantId { get; set; }
        public int? DepartmentId { get; set; }
    }
}
